<template>
  <div class="goodsList_box">
   
        <div class="content" v-for="items in getgoodsData" :key="items.id" >
            <router-link :to="'/goods/goodsInfo/'+items.id" tag="div">
                 <div class="photoImg">
                    <img :src="items.img_url" alt="">
                </div>
                <div class="title">{{items.title}}</div>
                <div class="price">
                    <span>￥{{items.sell_price}}</span><del>￥{{items.market_price}}</del>    
                </div>
                <div class="status">
                    <span>热卖中</span><span>剩余{{items.stock_quantity}}件</span>
                </div>
            </router-link>
           
        </div>
    
  </div>
</template>
<script>
export default {
  data() {
    return {
      pageindex:1,
      getgoodsData:[]
    };
  },
  created() {
      this.getgoods()
  },
  methods: {
      getgoods(){
          this.$http.get('api/getgoods?pageindex='+this.pageindex).then(res=>{
              console.log(res);
              if(res.body.status==0){
                  this.getgoodsData=res.body.message
              }
              
          })
      }
      
  },
}
</script>
<style lang="scss" >
  .goodsList_box{
      display: flex;
      justify-content: space-between;
      padding: 7px;
      flex-wrap: wrap;
    .content{
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        border: 1px solid #ccc;
        width: 48%;
        overflow: hidden;
        .photoImg{
            text-align: center;
            img{
                width: 100%;
            }

        }
        .title{
            font-size: 14px;
        }
        .price{
            span{
                color: red;
            }
            del{
                font-size: 12px;
            }
        }
        .status{
            display: flex;
            justify-content: space-between;
            span{
                font-size: 14px;
                color: rgb(12, 12, 12);
            }
        }
    }
      
  }
</style>